// pages/seeMore/seeMore.js
Page({
    data: {
        searchText: '',
        list: [],
        id: '',
        listLoading: false,
        params() {
            return {
                category_id: this.data.id,
                search_str: this.data.searchText,
            };
        },
    },

    onLoad(options) {
        console.log(options);
        if (options) {
            const id = options.id;
            this.setData({
                id,
            });
            // this.getList();
        }
    },
    // 开启页面分享
    onShareAppMessage(e) {
        console.log(e);
    },
    getList() {
        this.setData({
            listLoading: true,
        });
        this.request({
            url: 'user/index/goods/index',
            data: {
                page: 1,
                limit: 999,
            },
        })
            .then(res => {
                // console.log(res);
                this.setData({
                    list: res.data.data,
                });
                this.setData({
                    listLoading: false,
                });
            })
            .catch(err => {
                this.setData({
                    listLoading: true,
                });
            });
    },

    onSubmit(e) {
        this.setData({
            searchText: e.detail.value,
        });
        this.paging.reRequest();
    },

    onSearchChange(e) {
        if (e.detail.value == '') {
            this.setData({
                searchText: '',
            });
            this.paging.reRequest();
        }
    },
});
